﻿ #define _CRT_SECURE_NO_WARNINGS 1

int findMaxForm(vector<string>& strs, int m, int n) {
	int len = strs.size();
	vector<vector<vector<int>>> dp(len + 1, vector<vector<int>>(m + 1, vecto
		for (int i = 1; i <= len; i++)
		{
			// 统计⼀下 0 1 的个数
			int a = 0, b = 0;
			for (auto ch : strs[i - 1])
				if (ch == '0') a++;
				else b++;
			for (int j = m; j >= 0; j--)
				for (int k = n; k >= 0; k--)
				{
					dp[i][j][k] = dp[i - 1][j][k];
					if (j >= a && k >= b)
						dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j - a][k - b] +
				}
		}
	return dp[len][m][n];
}
};